Telegram Group & Telegram Channel
Гарантирует ли ConcurrentHashMap видимость между потоками? Нужно ли дополнительно синхронизировать put() и get() для корректной работы?

ConcurrentHashMap уже обеспечивает необходимую памятную видимость (happens-before) между put() и get() — дополнительная синхронизация не нужна.

Если put() завершился до начала get(), то get() обязательно увидит вставленное значение. Это гарантируется внутренней реализацией: через volatile поля, CAS-операции и memory barriers.

🐸 Библиотека собеса по Java
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/java_interview_lib/860
Create:
Last Update:

Гарантирует ли ConcurrentHashMap видимость между потоками? Нужно ли дополнительно синхронизировать put() и get() для корректной работы?

ConcurrentHashMap уже обеспечивает необходимую памятную видимость (happens-before) между put() и get() — дополнительная синхронизация не нужна.

Если put() завершился до начала get(), то get() обязательно увидит вставленное значение. Это гарантируется внутренней реализацией: через volatile поля, CAS-операции и memory barriers.

🐸 Библиотека собеса по Java

BY Библиотека собеса по Java | вопросы с собеседований


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/java_interview_lib/860

View MORE
Open in Telegram


Библиотека собеса по Java | вопросы с собеседований Telegram | DID YOU KNOW?

Date: |

Mr. Durov launched Telegram in late 2013 with his brother, Nikolai, just months before he was pushed out of VK, the Russian social-media platform he founded. Mr. Durov pitched his new app—funded with the proceeds from the VK sale—less as a business than as a way for people to send messages while avoiding government surveillance and censorship.

What Is Bitcoin?

Bitcoin is a decentralized digital currency that you can buy, sell and exchange directly, without an intermediary like a bank. Bitcoin’s creator, Satoshi Nakamoto, originally described the need for “an electronic payment system based on cryptographic proof instead of trust.” Each and every Bitcoin transaction that’s ever been made exists on a public ledger accessible to everyone, making transactions hard to reverse and difficult to fake. That’s by design: Core to their decentralized nature, Bitcoins aren’t backed by the government or any issuing institution, and there’s nothing to guarantee their value besides the proof baked in the heart of the system. “The reason why it’s worth money is simply because we, as people, decided it has value—same as gold,” says Anton Mozgovoy, co-founder & CEO of digital financial service company Holyheld.

Библиотека собеса по Java | вопросы с собеседований from hk


Telegram Библиотека собеса по Java | вопросы с собеседований
FROM USA